define(
  ['stuff', 'sharedc'],
  function(stuff, encod, socket, sharedc){
    var resp = '';
    //var got_def_ev = new Event('got_def');
    var gsocketid = 0;
    var cache = {};
    var lword = '';
    function get_def(word){
        sharedc.exec('dict', 'got_def')(resp);

    }
    return {
        response:function(){
        },
        push_cache:function(def){
            cache[lword] = def;
            var keys = Object.keys(cache);
            if(keys.length>64) delete cache[keys[0]];
        },
        get_def:function(texts){
            var word = texts[0];
            if(texts[1] && texts.length>0) seealso = texts[1].map(function(itm){
                    var a = document.createElement("span");
                    a.textContent = itm;
                    a.onclick = function(evt){get_def(evt.target.textContent);};
                    //a.addEventListener("click", function(evt){get_def(evt.target.textContent);}, false);
                    return a;
                });
            else seealso=[];
            get_def(word);
        },
        get_dbs:function(type){
        },
        lword:function(){return lword},
        init_params:function(params){
            cache = {};
        }
    };
  }
);
